<?php
/**
 * Created by PhpStorm.
 * Admininfo: Administrator
 * Date: 2018/3/22
 * Time: 13:36
 */
namespace app\admin\controller;
use app\common\controller\Curt;
use think\Db;
class Shopremark extends Curt {
    public function getall()
    {
        $keyword=trim(input('get.keyword'));
        $where['a.s_isdisplay']=1;
        if($keyword){
            $where['c.shop_name']=['like','%'.$keyword.'%'];//模糊查询or可以一个条件中写多个字段以‘|’分开
        }
        $shopremark=Db::name('shopremark')->alias('a')
            ->join('ec_user b','a.s_uid=b.id','left')
            ->join('ec_shop c','a.s_shopid=c.id','left')
            ->join('ec_orderinfo d','a.s_order=d.id','left')
            ->where($where)
            ->field('a.*,b.user_nickname,c.shop_name,d.o_number')
            ->order('a.id desc')
            ->paginate();
        $shopremarks=$shopremark->toArray();
        $page = $shopremark->render();
        $this->assign(
            ['shopremark'=>$shopremarks['data']],
            ['page'=>$page]
        );
    }

}